﻿@model IEnumerable<KRM.Core.vWebRefundReport>
@{
    ViewBag.Title = "Refund Report";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="/js/tabletocsv.js"></script>
<form class="margin0" method="GET">
    <div class="container-fluid">
        <div class="row-fluid page-header">
            <div class="span1 text-right" style="padding-top: 5px;">Start</div>
            <div class="span3">
                <div class="input-append datetimepicker">
                    <input type="text" name="Start" value="@(Request["start"] ??  DateTime.Now.AddDays(-1).ToString("dd/MM/yyyy"))" data-format="dd/MM/yyyy" class="input-block-level" />
                    <span class="add-on">
                        <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                    </span>
                </div>
            </div>
            <div class="span1 text-right" style="padding-top: 5px;">End</div>
            <div class="span3">
                <div class="input-append datetimepicker">
                    <input type="text" name="End" value="@(Request["end"] ?? DateTime.Now.ToString("dd/MM/yyyy"))" data-format="dd/MM/yyyy" class="input-block-level"  />
                    <span class="add-on">
                        <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                    </span>
                </div>
            </div>
            <div class="span1 text-right">
                <input type="submit" value="Filter" class="btn btn-primary" />
            </div>
            <div class="span3 text-right">
                <button class="btn btn-info w90" type="button" onclick="ExportCSVWithHead($('.tbody'), 'Table.csv', $('.thead'))">
                    <img src="/img/icon-exel.png" style="max-height: 20px">
                    Export</button>
            </div>
            </div>
        </div>
        <table class="table table-bordered table-fix krmtable" data-height="500">
            <thead class="thead">
                <tr>
                    <th>​OrderRef</th>
                    <th>OrderStatus</th>
                    <th>GoodsSource</th>
                    <th>OrderFrom</th>
                    <th>ProductName</th>
                    <th>OrderAmount</th>
                    <th>RefundAmount</th>
                    <th>OrderDate</th>
                    <th>DeliveryDate</th>
                    <th>CancellationRequestDate</th>
                    <th>CollectionDate</th>
                    <th>RefundDate</th>
                    <th>Reason</th>
                    <th>CancellationMinusOrderDate</th>
                    <th>RefundMinusCancellationDate</th>
                </tr>
            </thead>
            <tbody class="tbody">
                @foreach (var item in Model)
                {
                    <tr>
                        <td>@item.Ref</td>
                        <td>@item.OrderDelivered</td>
                        <td>@item.GoodsSource</td>
                        <td>@item.OrderedFrom</td>
                        <td>@item.ProductName</td>
                        <td>@item.OrderAmount</td>
                        <td>@item.RefundAmount</td>
                        <td>@string.Format("{0:dd/MM/yyyy}", item.OrderDate)</td>
                        <td>@item.DeliveryDate</td>
                        <td>@item.CancellationRequestDate</td>
                        <td>@item.CollectionDate</td>
                        <td>@item.RefundDate</td>
                        <td>@item.Reason</td>
                        <td>@item.CancellationMinusOrderDate</td>
                        <td>@item.RefundMinusCancellationDate</td>
                    </tr>
                }
            </tbody>
        </table>
</form>
